home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Development / RxMUI / Examples / TheBar1.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2004-01-31  |  9.1 KB  |  288 lines

  1. /*  */
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call Init
  7. call CreateApp
  8. call HandleApp
  9.  
  10. /***********************************************************************/
  11. Init: procedure
  12.     l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  13.     if AddLibrary("rexxsupport.library","rxmui.library")~=0 then exit
  14.     call ProgDir()
  15.     return
  16. /***********************************************************************/
  17. HandleApp: procedure
  18.     ctrl_c=2**12
  19.     do forever
  20.         call NewHandle("app","h",ctrl_c)
  21.         if and(h.signals,ctrl_c)>0 | h.event="QUIT" then exit
  22.         interpret h.event
  23.     end
  24. /***********************************************************************/
  25. CreateApp: procedure
  26.     app.Title="TheBar"
  27.     app.Version="$VER: TheBar 1.0 (6.6.2003)"
  28.     app.Copyright="©2003 by alfie"
  29.     app.Author="alfie"
  30.     app.Description="TheBar example"
  31.     app.Base="TheBar"
  32.  
  33.     app.SubWindow.0="bwin"
  34.      bwin.ID="BWIN"
  35.      bwin.Title="TheBar Example"
  36.      bwin.Contents="mbgroup"
  37.       mbgroup.0="TheBar"
  38.        TheBar.class="TheBar"
  39.        TheBar.Horiz=1
  40.        TheBar.PicsDrawer="PROGDIR:Pics"
  41.        TheBar.EnableKeys=1
  42.        TheBar.Framed=1
  43.        TheBar.DragBar=1
  44.        TheBar.AutoID=1
  45.        TheBar.ViewMode="GFX"
  46.        TheBar.Strip="YAM:Icons/Main.toolbar"
  47.        TheBar.StripCols=14
  48.  
  49.         TheBar.0.Img=0
  50.         TheBar.0.Text="Read"
  51.         TheBar.0.Help="Read mail."
  52.  
  53.         TheBar.1.Img=1
  54.         TheBar.1.Text="Edit"
  55.         TheBar.1.Help="Edit mail."
  56.  
  57.         TheBar.2.Img="Bar"
  58.  
  59.         TheBar.3.Img=2
  60.         TheBar.3.Text="Move"
  61.         TheBar.3.Help="Move mail."
  62.  
  63.         TheBar.4.Img=3
  64.         TheBar.4.Text="Delete"
  65.         TheBar.4.Help="Delete mail."
  66.  
  67.         TheBar.5.Img="Button"
  68.  
  69.         TheBar.6.Img=4
  70.         TheBar.6.Text="Get"
  71.         TheBar.6.Help="Get mail."
  72.  
  73.         TheBar.7.Img=5
  74.         TheBar.7.Text="New"
  75.         TheBar.7.Help="Write mail."
  76.  
  77.         TheBar.8.Img="Image"
  78.  
  79.         TheBar.9.Img=7
  80.         TheBar.9.Text="Reply"
  81.         TheBar.9.Flags="Toggle"
  82.         TheBar.9.Help="Reply mail."
  83.  
  84.         TheBar.10.Img="Bar"
  85.  
  86.         TheBar.11.Img=9
  87.         TheBar.11.Text="Forward"
  88.         TheBar.11.Flags="Selected"
  89.         TheBar.11.Exclude=2**12
  90.         TheBar.11.Help="Forward mail."
  91.  
  92.         TheBar.12.Img=10
  93.         TheBar.12.Text="Fetch"
  94.         TheBar.12.Exclude=2**11
  95.         TheBar.12.Help="Fetch mail."
  96.  
  97.     app.SubWindow.1="cwin"
  98.      cwin.ID="CWIN"
  99.      cwin.Title="TheBar Example controls"
  100.      cwin.Contents="cmgroup"
  101.  
  102.       cmgroup.0="ag"
  103.        ag.class="Group"
  104.        ag.columns=2
  105.         ag.0=label("Appearance")
  106.         ag.1=MakeObj("vm","Cycle","Icons and Text|Icons|Text",,1)
  107.         ag.2=label("Bar pos")
  108.         ag.3=MakeObj("bp","Cycle","Left|Center|Right")
  109.         ag.4=label("Label pos")
  110.         ag.5=MakeObj("lp","Cycle","Down|Up|Right|Left")
  111.  
  112.       cmgroup.1="sg"
  113.        sg.class="scrollgroup"
  114.         sg.virtgroupcontents="vg"
  115.         sg.freehoriz=0
  116.          vg.class="virtgroup"
  117.          vg.frame="virtual"
  118.           vg.0="hg"
  119.            hg.class="hgroup"
  120.             hg.0="cg"
  121.              cg.class="group"
  122.              cg.columns=2
  123.               cg.0=checkmark("BL")
  124.               cg.1=label("BorderLess","Left")
  125.               cg.2=checkmark("RF")
  126.               cg.3=label("Raised","Left")
  127.               cg.4=checkmark("SI")
  128.               cg.5=label("Scaled","Left")
  129.               cg.6=checkmark("SN")
  130.               cg.7=label("Sunny","Left")
  131.  
  132.               cg.8=vfspace("X")
  133.               cg.9=vfspace("X")
  134.  
  135.               cg.10=checkmark("horiz",1)
  136.               cg.11=label("Horiz","Left")
  137.               cg.12=checkmark("freehoriz",1)
  138.               cg.13=label("Free horiz","Left")
  139.               cg.14=checkmark("freevert",)
  140.               cg.15=label("Free vert","Left")
  141.               cg.16=checkmark("BarSpacer")
  142.               cg.17=label("Bar spacers","Left")
  143.  
  144.               cg.18=vfspace("X")
  145.               cg.19=vfspace("X")
  146.  
  147.               cg.20=checkmark("cm1",1)
  148.               cg.21=Label("Enable back","Left")
  149.               cg.22=checkmark("cm2")
  150.               cg.23=Label("Hide stop","Left")
  151.               cg.24=checkmark("cm3")
  152.               cg.25=Label("Sleep home","Left")
  153.  
  154.               cg.26=vfspace("X")
  155.               cg.27=vfspace("X")
  156.  
  157.               cg.28=checkmark("rbar")
  158.               cg.29=Label("Remove bar spacers","Left")
  159.               cg.30=checkmark("rbut")
  160.               cg.31=Label("Remove button spacers","Left")
  161.               cg.32=checkmark("rim")
  162.               cg.33=Label("Remove image spacer","Left")
  163.               cg.34=checkmark("rall")
  164.               cg.35=Label("Remove all spacers","Left")
  165.  
  166.             hg.1=hspace()
  167.           vg.1=vspace()
  168.  
  169.       cmgroup.2="tg"
  170.        tg.class="Group"
  171.        tg.columns=2
  172.         tg.0=label("Cols")
  173.         tg.1=MakeObj(,"HLeft",MakeObj("cols","Radio","0|1|2|3|4|5|6|7|8|9|10",,,1))
  174.         tg.2=label("Rows")
  175.         tg.3=MakeObj(,"HLeft",MakeObj("rows","Radio","0|1|2|3|4|5|6|7|8|9|10",,,1))
  176.  
  177.     if NewObj("Application","app")>0 then exit
  178.  
  179.     call get("TheBar","TextOnly","nb")
  180.     call set("vm","disabled",nb)
  181.     call set("lp","disabled",nb)
  182.     call set("sn","disabled",nb)
  183.     call set("si","disabled",nb)
  184.  
  185.     call Notify("cols","active","EveryTime","app","return","call table")
  186.     call Notify("rows","active","EveryTime","app","return","call table")
  187.  
  188.     call Notify("rbar","selected","EveryTime","app","return","call table")
  189.     call Notify("rbut","selected","EveryTime","app","return","call table")
  190.     call Notify("rim","selected","EveryTime","app","return","call table")
  191.     call Notify("rall","selected","EveryTime","app","return","call table")
  192.  
  193.     call Notify("vm","active","EveryTime","TheBar","set","viewmode","TriggerValue")
  194.     call Notify("bp","active","EveryTime","TheBar","set","barpos","TriggerValue")
  195.     call Notify("lp","active","EveryTime","TheBar","set","labelpos","TriggerValue")
  196.  
  197.     call Notify("bwin","closerequest",1,"app","returnid","quit")
  198.     call Notify("cwin","closerequest",1,"app","returnid","quit")
  199.  
  200.     call Notify("bl","selected","everytime","TheBar","set","borderless","triggervalue")
  201.     call Notify("rf","selected","everytime","TheBar","set","raised","triggervalue")
  202.     call Notify("si","selected","everytime","TheBar","set","scaled","triggervalue")
  203.     call Notify("sn","selected","everytime","TheBar","set","sunny","triggervalue")
  204.  
  205.     call Notify("TheBar","active","EveryTime","app","return","say 'Active:'h.active","triggerattr")
  206.  
  207.     call Notify("cm1","selected","EveryTime","TheBar","TheBarSet",0,"Disabled","NotTriggerValue")
  208.     call Notify("cm2","selected","EveryTime","TheBar","TheBarSet",4,"Hide","TriggerValue")
  209.     call Notify("cm3","selected","EveryTime","TheBar","TheBarSet",6,"Sleep","TriggerValue")
  210.  
  211.     call Notify("horiz","selected","EveryTime","app","return","call horizFun(h.selected)","TriggerAttr")
  212.     call Notify("freehoriz","selected","EveryTime","TheBar","set","FreeHoriz","TriggerValue")
  213.     call Notify("freevert","selected","EveryTime","TheBar","set","FreeVert","TriggerValue")
  214.     call Notify("BarSpacer","selected","EveryTime","TheBar","set","BarSpacer","TriggerValue")
  215.  
  216.     call TheBarNotify("TheBar",0,"pressed",0,"app","return","say 'Back pressed'")
  217.     call TheBarNotify("TheBar",1,"pressed",0,"app","return","say 'Forward pressed'")
  218.     call TheBarNotify("TheBar",3,"pressed",0,"app","return","say 'Reload pressed'")
  219.     call TheBarNotify("TheBar",4,"pressed",0,"app","return","say 'Stop pressed'")
  220.     call TheBarNotify("TheBar",6,"pressed",0,"app","return","say 'Home pressed'")
  221.     call TheBarNotify("TheBar",7,"pressed",0,"app","return","say 'Find pressed'")
  222.  
  223.     call TheBarNotify("TheBar",9,"selected","Everytime","app","return","say 'java selected:'h.selected","TriggerAttr")
  224.  
  225.     call set("cwin","open",1)
  226.     call set("bwin","open",1)
  227.  
  228.     /*s.0=1
  229.     s.1=2
  230.     s.2=4
  231.  
  232.     call DoMethod("TheBar","TheBarSort","s")
  233.  
  234.     add.ID=22
  235.     add.Img=8
  236.     add.Text="Added"
  237.     add.Help="Added"
  238.     call DoMethod("TheBar","thebaradd","add")
  239.     s.0=22
  240.     call DoMethod("TheBar","TheBarSort","s")*/
  241.  
  242.     return
  243. /***********************************************************************/
  244. halt:
  245. break_c:
  246.     exit
  247. /**************************************************************************/
  248. table: procedure
  249.     r=""
  250.     if xget("rbar","selected") then r=r "BARS "
  251.     if xget("rbut","selected") then r=r "BUTTONS "
  252.     if xget("rim","selected")  then r=r "IMAGES"
  253.     if xget("rall","selected")  then r=r "ALL"
  254.  
  255.     call DoMethod("TheBar","InitChange")
  256.  
  257.     call set("TheBar","Remove",r)
  258.     call set("TheBar","BarCols",0)
  259.     call set("TheBar","BarCols",xget("cols","Active"))
  260.     call set("TheBar","BarRows",xget("rows","Active"))
  261.  
  262.     call DoMethod("TheBar","ExitChange")
  263.  
  264.     return
  265. /**************************************************************************/
  266. horizFun: procedure
  267. parse arg h
  268.  
  269.     if xget("rbar","selected") then r="BARS"
  270.     else r=""
  271.     if xget("rbut","selected") then r=r "BUTTONS"
  272.     if xget("rall","selected")  then r=r "ALL"
  273.     if h then im=""
  274.     else im="IMAGES"
  275.  
  276.     call DoMethod("thebar","initchange")
  277.  
  278.     call set("thebar","remove",r im)
  279.     call set("freehoriz","selected",h,1)
  280.     call set("freevert","selected",~h,1)
  281.     call set("rim","selected",~h,1)
  282.  
  283.     call set("thebar","Horiz",h)
  284.  
  285.     call DoMethod("thebar","exitchange")
  286.     return
  287.  
  288.